<?php

class Zendhlt_View_Helper_CmsTabs extends Zend_View_Helper_Abstract {
	
	public function cmsTabs($title, $info = null) {
		$img = $info['slideshow'];
		
		$xhtml = '<div class="tabs">';
		$xhtml .= '<ul class="nav nav-tabs">';
		$xhtml .= '<li class="pane1 active"><a href="#map-pane1" data-toggle="tab">' . $title["pane1"] . '</a></li>';
		
		if (preg_match("/(.*)[,](.*)/", $img)) {
			$xhtml .= '<li class="pane2"><a href="#slideshow-pane2" data-toggle="tab">' . $title["pane2"] . '</a></li>';
		}
		
		if (!empty($info['video'])) {
			$xhtml .= '<li class="pane3"><a href="#video-pane3" data-toggle="tab">' . $title["pane3"] . '</a></li>';
		}
		$xhtml .= '</ul>';
		$xhtml .= '<div class="view-content">';
		$xhtml .= '<div class="tab-content">';
		
		// Pane map
		$xhtml .= '<div class="tab-pane active" id="#map-pane1"><br/>';
		$xhtml .= '<div id="map_canvas"></div>';
		$xhtml .= '</div>';
		
		// Pane slideshow image
		if (preg_match("/(.*)[,](.*)/", $img)) {
			$list_image = explode (',', $img);
			$xhtml .= '<div class="tab-pane active" id="#slideshow-pane2">';
			$xhtml .= '</div>';
		}
		
		// Pane video
		if (!empty($info['video'])) {
			$xhtml .= '<div class="tab-pane active" id="#video-pane3">';
			$xhtml .= '<iframe src="' . $info['video'] . '" width="100%" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
			$xhtml .= '</div>';
		}
		
		$xhtml .= '</div>';
		$xhtml .= '<br class="clear" /></div>';
		$xhtml .= '</div>';
		
		return $xhtml;
	}
}